package com.bicycle.entity;

import lombok.Data;

import java.util.List;

/**
 * 路线类
 */
@Data
public class Route {

    private List<Point>route;
    private int nodeAmount;//路线当中节点的总数
    private int flag;//当前位置


    //创建
    public Route(List<Point> route){

        this.route = route;
        this.flag =0;
        this.nodeAmount=route.size();
    }

    //移动一次节点
    public void move(){
        flag++;
    }

    //查看下一个节点
    public Point nextNode(){

        return route.get(flag);
    }

    //判断是否到达目的地
    public boolean isArrived(){
        return flag == nodeAmount;
    }

}
